#include <iostream>
#include <vector>

using namespace std;

bool isnothuiwen(int pos, string& s, int len) {
    int st = pos - len - 1;
    int ed = st + (len + 1) / 2;
    for (int i = st; i < ed; ++i)
        if (s[i] != s[pos - 1 - i]) return true;
    return false;
}

int main() {
    string s = "abccba";
    //cin >> s;
    int n = s.size();
    int ret = 1;
    vector<int> dp(n + 1, 1);
    for (int i = 2; i <= n; ++i) {
        if (isnothuiwen(i, s, dp[i - 1])) dp[i] += dp[i - 1];
        else {
            for (int pos = i - dp[i - 1]; pos <= i; ++pos) {
                if (isnothuiwen(i, s, i - pos - 1)) dp[i] = i - pos + 1;
            }
        }

        ret = max(ret, dp[i ]);
    }
    cout << ret;
}
